package com.itheima.jianbing3;

import com.itheima.jianbing2.Desk;

import java.util.concurrent.ArrayBlockingQueue;

public class Foodie implements Runnable {

    private ArrayBlockingQueue<String> queue;

    public Foodie(ArrayBlockingQueue<String> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        //只管 从容器中拿就可以了
        while (true) {
            String take = null;
            try {
                take = queue.take();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"吃一个"+take);
        }

    }
}
